package fudan.se.project.controller.request;

import fudan.se.project.controller.request.base.DateSet;
import fudan.se.project.domain.conference.Conference;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.Set;

/**
 * @author X Yang
 * property need to be inspected
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class ConferenceApplyRequest {

    @NotNull
    @NotBlank
    private String shortname;

    @NotNull
    @NotBlank
    private String fullname;

    @NotNull
    private DateSet dateSet;

    @NotNull
    @NotBlank
    private String place;

    @NotNull
    @NotEmpty
    private Set<String> topics;


    public Conference toConference() {

        // dateStart, deadline, dateReleased, dateEnd
        return new Conference(shortname, fullname, place,
                dateSet.getDateStart(),
                dateSet.getDeadline(),
                dateSet.getDateRelease(),
                dateSet.getDateEnd()
        );
    }


}
